package com.mhb.servlet;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.mhb.domain.Employee;
import com.mhb.service.EmployeeService;

/**
 * Servlet implementation class UpdateUiServlet
 */
@WebServlet("/UpdateUiServlet")
public class UpdateUiServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
  
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		
		String id=request.getParameter("id");
		
		EmployeeService employeeService=new EmployeeService();
		try {
			Employee employee = employeeService.getEmployeeById(Integer.valueOf(id));
			request.setAttribute("employee", employee);
			request.getRequestDispatcher("/updateEmployee.jsp").forward(request, response);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}


}
